package com.pearl.web.demo.controller;

import com.pearl.web.demo.mvc.User;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TangDan
 * @version 1.0
 * @since 2023/3/16
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/test001")
    public Object test001(@Validated User user){
        return user;
    }

    @GetMapping("/test002")
    public Object test002() throws Exception {
        if (true){
            throw new RuntimeException();
        }
        return "Object";
    }
}
